package com.gupaoedu.concurrent.thread;

import java.util.concurrent.*;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * 2019/6/3
 * created by chenpp
 */
public class MyLock {
    static int  COUNT_BITS = 29;
    private static final int RUNNING    = -1 << COUNT_BITS;
    private static final int SHUTDOWN   =  0 << COUNT_BITS;
    private static final int STOP       =  1 << COUNT_BITS;
    private static final int TIDYING    =  2 << COUNT_BITS;
    private static final int TERMINATED =  3 << COUNT_BITS;

    public static void main(String[] args) throws InterruptedException, ExecutionException {
         Lock lock = new ReentrantLock();
        Condition condition = lock.newCondition();
        lock.lock();
        lock.unlock();

        condition.await();
        condition.signal();

        ConcurrentHashMap map = new ConcurrentHashMap();
        map.put("","");
        ExecutorService executor = Executors.newCachedThreadPool();
        executor.execute(new Runnable() {
            @Override
            public void run() {

            }
        });
        executor.submit(new Runnable() {
            @Override
            public void run() {

            }
        });
        FutureTask futureTask = new FutureTask(new Callable() {
            @Override
            public Object call() throws Exception {
                return null;
            }
        });
        futureTask.get();
        System.out.println(RUNNING+","+SHUTDOWN+","+STOP);

    }

}
